﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddContato_Cliente.aspx.cs" Inherits="NewTierra.Pages.Cliente.AddContato_Cliente" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

      <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
      <script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>
      <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js" type="text/javascript"></script>

      <link href="../../Styles/EstiloGeral.css" rel="stylesheet" type="text/css" />

    <title></title>
    <style type="text/css">
        #FormContatos
        {
            height: 387px;
            width: 926px;
        }
        
        #FormContatos .GridContatos
        {
            float: left;
            height: 215px;
            width: 499px;
            margin-top: 10px;
        }
        #FormContatos .FormCadastroContatos
        {
            float: left;
            width: 417px;
            height: 379px;
        }
        .invisible
        {
            display: none;
        }
        #form1
        {
            width: 930px;
        }
    </style>
</head>
<body>

    <script type="text/javascript">

        jQuery(function ($) {
            $.datepicker.regional['pt-BR'] = {
                closeText: 'Fechar',
                prevText: '&#x3c;Anterior',
                nextText: 'Pr&oacute;ximo&#x3e;',
                currentText: 'Hoje',
                monthNames: ['Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho',
             'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
                monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',
             'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
                dayNames: ['Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sabado'],
                dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
                dayNamesMin: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
                weekHeader: 'Sm',
                dateFormat: 'dd/mm/yy',
                firstDay: 0,
                isRTL: false,
                showMonthAfterYear: false,
                yearSuffix: ''
            };
            $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
        });

        $(function () {
            $("#txtDataNiver").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });            
        });

    </script>

     <form id="form1" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server"/>

    <div id="FormContatos">
    
     <div class="FormCadastroContatos">

         <fieldset style="height: 380px">
             <legend>Cadastrar Contatos</legend>
         
         <asp:TextBox ID="txtCodigo" CssClass="invisible" runat="server" ReadOnly="True" Width="50px" />

         <asp:Label ID="lblNomeContatoClienteTXT" runat="server" Text="Nome:"></asp:Label> <br />
         <asp:TextBox ID="txtNome" runat="server" Width="200px" MaxLength="50" />
         <asp:RequiredFieldValidator ID="requireNome" runat="server" 
         ControlToValidate="txtNome" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Campo requerido." ValidationGroup="Salvar">
         </asp:RequiredFieldValidator>
         <br />

         <asp:Label ID="lblTelefoneContatoClienteTXT" runat="server" Text="Telefone:"></asp:Label> <br />
         <asp:TextBox ID="txtTelefone" runat="server" Width="150px" MaxLength="15" />
         <br />

         <asp:Label ID="lblFaxContatoClienteTXT" runat="server" Text="Fax:"></asp:Label> <br />
         <asp:TextBox ID="txtFax" runat="server" Width="150px" MaxLength="15" />
         <br />
         
         <asp:Label ID="lblCargoContatoClienteTXT" runat="server" Text="Cargo:"></asp:Label> <br />
         <asp:TextBox ID="txtCargo" runat="server" Width="150px" MaxLength="50" />
         <br />

         <asp:Label ID="lblEmailContatoClienteTXT" runat="server" Text="Email:"></asp:Label> <br />
         <asp:TextBox ID="txtEmail" runat="server" Width="200px" MaxLength="50" />
         <asp:RequiredFieldValidator ID="requireEmail" runat="server" 
         ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Campo requerido." ValidationGroup="Salvar">
         </asp:RequiredFieldValidator>
         <asp:RegularExpressionValidator ID="regularEmail" runat="server" 
         ControlToValidate="txtEmail" ErrorMessage="*" ForeColor="Red" 
         ToolTip="Email inválido." 
         ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
         ValidationGroup="Salvar">
         </asp:RegularExpressionValidator>
         <br />

         <asp:Label ID="lblDataNiverContatoClienteTXT" runat="server" Text="Aniversário:"></asp:Label> <br />
         <asp:TextBox ID="txtDataNiver" runat="server" Width="100px" MaxLength="10" />
         <br />

         <asp:Label ID="lblMailingContatoClienteTXT" runat="server" Text="Mailing:"></asp:Label> <br />
         <asp:DropDownList ID="ddlMailing" runat="server" AppendDataBoundItems="true">
             <asp:ListItem Value="True" Selected="True">Sim</asp:ListItem>
             <asp:ListItem Value="False">Não</asp:ListItem>
         </asp:DropDownList>
         <br /><br />

         <asp:Label ID="lblContatoClienteTXT" runat="server" Text="Cliente:"></asp:Label>&nbsp;
         <asp:Label ID="lblContatoCliente" runat="server" Font-Size="Small"></asp:Label>
         <br /><br />

         <asp:Button ID="btnNovoContato" CssClass="btnsGeral" runat="server" Text="Salvar" ValidationGroup="Salvar" onclick="SalvarContato" />
         &nbsp;<asp:Button ID="btnUpdateContato" CssClass="btnsGeral" runat="server" onclick="AtualizarContato" Text="Atualizar" ValidationGroup="Salvar" />
         &nbsp;<asp:Button ID="btnExcluirContato" CssClass="btnsGeral" runat="server" onclick="ExcluirContato" Text="Excluir" />
         &nbsp;<asp:Button ID="btnLimpar" CssClass="btnsGeral" runat="server" Text="Limpar" onclick="Limpar"/>
         &nbsp;<asp:Button ID="btnFechar" CssClass="btnsGeral" runat="server" OnClientClick="window.close();" Text="Fechar"/>
         <br />
         
         <asp:Label ID="lblMsgAddContato" runat="server" Font-Bold="True" ForeColor="#CC0000" Font-Size="Small"></asp:Label>
        
       </fieldset>
    </div>

    <div class="GridContatos">
    
        <asp:GridView ID="GridContatosCliente" runat="server" AllowPaging="True"
         AutoGenerateColumns="False" GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr"
           AlternatingRowStyle-CssClass="alt" EmptyDataText="Não existe contato para esse Cliente."
            Height="16px" PageSize="8" OnPageIndexChanging="PaginarDados" onselectedindexchanged="GridContatosCliente_SelectedIndexChanged">
           <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>

           <Columns>
           <asp:BoundField DataField="Contato_id" HeaderText="ID" ReadOnly="True" 
                     SortExpression="Contato_id" InsertVisible="False">
                 <FooterStyle CssClass="invisible" />
               <HeaderStyle CssClass="invisible" />
               <ItemStyle CssClass="invisible" />
               </asp:BoundField>

                 <asp:BoundField DataField="Contato_nome" HeaderText="Nome" 
                     SortExpression="Contato_nome"/>

                      <asp:BoundField DataField="Contato_position" HeaderText="Cargo" 
                     SortExpression="Contato_position"/>

                      <asp:BoundField DataField="Contato_telefone" HeaderText="Telefone" 
                     SortExpression="Contato_telefone"/>

                     <asp:BoundField DataField="Contato_fax" HeaderText="Fax" 
                     SortExpression="Contato_fax"/>

                     <asp:BoundField DataField="Contato_email" HeaderText="Email" 
                     SortExpression="Contato_email"/>
                     
                     <asp:CommandField HeaderText="Editar" SelectText="Editar" 
                     ShowSelectButton="True" />

        </Columns>

        <PagerStyle CssClass="pgr"></PagerStyle>

        </asp:GridView>
    
    </div>

      </div>
    
    </form>
</body>
</html>